<?php
// +----------------------------------------------------------------------
// | 零云 [ 简单 高效 卓越 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016 http://www.lingyun.net All rights reserved.
// +----------------------------------------------------------------------
// | Author: jry <598821125@qq.com>
// +----------------------------------------------------------------------
namespace Home\Controller;
use Think\Model;

/**
 * 前台默认控制器
 * @author jry <598821125@qq.com>
 */
class IndexController extends HomeController
{
    /**
     * 默认方法
     * @author jry <598821125@qq.com>
     */
    public function index()
    {
        $this::nav();
        $this->assign('meta_title', "首页");
        $this->display();
    }

<<<<<<< HEAD
    public function about()
    {
      $this::nav();
      $this->assign('meta_title', "公司简介");
      $this->display();
    }

    public function about_culture()
    {
      $this::nav();
      $this->assign('meta_title', "公司文化");
      $this->display();
    }

    public function news()
    {
      $this::nav();

      // $news_list=M('AdminNews')->select();
      $Model = new Model();
      $news_list=$Model->query("select * from ly_admin_news as a left join ly_admin_upload as b on a.id = b.uid");


      $this->assign('meta_title', "公司新闻");
      $this->assign('news_list', $news_list);
      $this->display();
    }
    public function detail(){
      $ids = $_GET['id'];
      $Model = new Model();
      $data['id']=$ids;
      // $news_conn=$Model->query("select * from ly_admin_news where id=$ids");
      echo $ids;
      $news_conn=M('AdminNews')->where($data)->find();

      //上一篇
      $top['id'] = array('lt' ,$ids );
      $news_conn_top=M('AdminNews')->where($top)->limit(1)->find();
    

      //下一篇
      $after['id']  = array('gt',$ids);
      $news_conn_after=M('AdminNews')->where($after)->limit(1)->find();

      $this->assign('news_conn_top',$news_conn_top);
      $this->assign('news_conn_after',$news_conn_after);
      $this->assign('news', $news_conn);
      $this->display();
    }

    public function marketing()
    {
      $this::nav();
      $this->assign('meta_title', "招商流程");
      $this->display();
    }

    public function media()
    {
      $this::nav();
      $this->assign('meta_title', "视频中心");
      $this->display();
    }

    public function msg()
    {
      $this::nav();
      $this->assign('meta_title', "在线留言");
      $this->display();
    }

    public function contact()
    {
      $this::nav();
      $this->assign('meta_title', "联系我们");
      $this->display();
    }

=======
>>>>>>> 034192825c7968eb0b5d4461912c4522d3836f84
    /**
     * 系统配置
     * @author jry <598821125@qq.com>
     */
    public function config($name = '')
    {
        $data_list = C($name);
        $this->assign('data_list', $data_list);
        $this->assign('meta_title', '系统配置');
        $this->display();
    }

    /**
     * 导航
     * @author jry <598821125@qq.com>
     */
<<<<<<< HEAD
    public function nav($group = 'top')
    {
        $data_list = D('Admin/Nav')->getNavTree(0, $group);

        $this->assign('data_list', $data_list);
        // $this->display();
=======
    public function nav($group = 'bottom')
    {
        $data_list = D('Admin/Nav')->getNavTree(0, $group);
        $this->assign('data_list', $data_list);
        $this->assign('meta_title', '导航列表');
        $this->display();
>>>>>>> 034192825c7968eb0b5d4461912c4522d3836f84
    }

    /**
     * 模块
     * @author jry <598821125@qq.com>
     */
    public function module()
    {
        $map['status'] = 1;
        $data_list     = D('Admin/MODULE')->where($map)->select();
        $this->assign('data_list', $data_list);
        $this->assign('meta_title', '模块列表');
        $this->display();
    }

    /**
     * 发现页面
     * 主要是移动端使用
     * @author jry <598821125@qq.com>
     */
    public function find()
    {
        $data_list = D('Admin/Nav')->getNavTree(0, 'find');
        $this->assign('data_list', $data_list);
        $this->assign('meta_title', '发现');
        $this->display();
    }
<<<<<<< HEAD


    // public function top_list($group='top')
    // {
    //
    //   $Model = new \Think\Model(); // 实例化一个model对象 没有对应任何数据表
    //   $data_list = $Model->query("select * from ly_admin_nav");
    //   $this->assign('data_list', $data_list);
    //   return $data_list;
    // }


=======
>>>>>>> 034192825c7968eb0b5d4461912c4522d3836f84
}
